<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>过滤器</title>
</head>
<body>
<div id="app">
  {{'hello' | my}}
</div>

<div id="app2">
  {{'hello' | my}}
</div>

</body>
<script src="../node_modules/vue/dist/vue.js"></script>
<script>
  //全局过滤器,要放在页面的顶部
  Vue.filter('my', (data) => {
      return 'hi ' + data;
    }
  )

  new Vue({
    el: '#app'
  })

  new Vue({
    el: '#app2'
  })

</script>
</html>
